package com.fastshopping.order.controller;

import com.fastshopping.order.pojo.Material;
import com.fastshopping.order.service.MaterialService;
import com.wink.entity.Result;
import com.wink.entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*
 * @Author zhangdan
 * @Description //TODO 素材操作
 * @Date 19:39 2020/6/5
 * @Param 
 * @return 
 **/
@RestController
@RequestMapping("/material")
public class MaterialController {
    
    @Autowired
    private MaterialService materialService;
    
    
    /*
     * @Author zhangdan
     * @Description //TODO 查询素材商城操作
     * @Date 19:42 2020/6/5
     * @Param []
     * @return com.wink.entity.Result
     **/
    @GetMapping
    public Result findAll(){

        List<Material> materialList = materialService.findAll();

        return new Result(true, StatusCode.OK,"查询成功",materialList);
    }

    /*
     * @Author zhangdan
     * @Description //TODO 我的素材库操作
     * @Date 22:10 2020/6/6
     * @Param [id]
     * @return com.wink.entity.Result
     **/
    @GetMapping("/{storeId}")
    public Result findMaterialById(@PathVariable int storeId) {
        List<Material> materialList = materialService.findMaterialById(storeId);

        return new Result(true, StatusCode.OK,"查询成功",materialList);
    }
    
}
